import { BaseEntity } from '../../base/entity/base';
import { Column, Entity, Index } from 'typeorm';

/**
 * 客户信息
 */
@Entity('customer_customer')
export class CustomerCustomerEntity extends BaseEntity {
  @Index()
  @Column({ comment: '名称', length: 255 })
  name: string;

  @Index({ unique: true })
  @Column({ comment: '电话', length: 20 })
  phone: string;

  @Column({ comment: '等级', dict: ['普通', 'VIP', 'SVIP'], default: 0 })
  level: number;

  @Column({ comment: '来源', dict: ['线上', '展会', '转介'], default: 0 })
  source: number;

  @Column({ comment: '状态', dict: ['潜在', '跟进中', '已成交'], default: 0 })
  status: number;

  @Column({ comment: '备注', nullable: true, type: 'text' })
  remark: string;

  @Column({ comment: '邮箱', nullable: true, length: 255 })
  email: string;

  @Column({ comment: '地址', nullable: true, length: 255 })
  address: string;

  @Column({ comment: '国家', nullable: true, length: 50 })
  country: string;

  @Column({ comment: '行业', dict: ['电子', '机械', '纺织'], default: 0 })
  industry: number;

  @Column({
    comment: '规模',
    dict: ['微型', '小型', '中型', '大型'],
    default: 0,
  })
  scale: number;

  @Index()
  @Column({ comment: '负责人', nullable: true })
  userId: number;

  @Column({ comment: '最近联系时间', type: 'varchar', nullable: true })
  lastContactTime: Date;
}
